<?php

class Core_Controller_Admincp_Widget_Add extends Nuo_Controller_Admincp
{
	function execute($request)
	{
		$table = Nuo::getTable('core/widget');
		$form = Nuo::getObject('ape/admincp/widget/add', 'form');

		$item = NULL;

		if ($request -> isGet() && $item)
		{

		}

		if ($request -> isPost() && $form -> isValid($_POST))
		{
			$data = $form -> getData();

			$item = $table -> fetchNew();

			$item -> fromArray($data);

			$item -> updated_at = time();

			$item -> save();

			Nuo_Messenger::instance()->add(Intl::__('Updated!'));
			
			return  array('jscript'=>'nuo.refresh();');
			
			return ;
		}

		return  Nuo::getView()->render('core/view/controller/admincp/edit', array('form' => $form));
	}

}
